Conversation
|
Работа Кожуро Б Е |
project/src/parallel.c
Outdated
| pthread_mutex_t mutex_write_lock; | ||
| pthread_mutex_init(&mutex_write_lock, NULL); |
There was a problem hiding this comment.
убрать, параллельная работа должна быть реализована без использования мьютексов
project/src/parallel.c
Outdated
|
|
||
| // this is parent process block | ||
| for (int i = 0; i < process_count; i++) { | ||
| waitpid(processes[i], NULL, 0); |
There was a problem hiding this comment.
https://linux.die.net/man/2/waitpid
добавить проверку возвращаемого значения и статуса
project/tests/parallel.cpp
Outdated
| file_search(&f1, c1, found, stf); | ||
| fclose(f1); | ||
| remove("1.txt"); | ||
| ASSERT_EQ(found[0], 4); |
There was a problem hiding this comment.
почему ASSERT, а не EXPECT?
project/src/main.c
Outdated
| // считывание символов | ||
| int size_to_find = 0; | ||
| char to_find[BUFFER_SIZE] = ""; | ||
| size_t found[BUFFER_SIZE] = {0}; |
There was a problem hiding this comment.
{0} это уже нулевая инициализация
project/src/parallel.c
Outdated
| for (int j = 0; j < size_to_find; j++) { | ||
| int count = 0; | ||
| for (size_t i = divisions[current_id]; | ||
| i < divisions[current_id+1]; i++) { | ||
| if (file_in_memory[i] == to_find[j]) | ||
| count++; | ||
| } | ||
| char str[BUFFER_SIZE] = "0"; | ||
| snprintf(str, READ_SIZE + 1, FORMAT_STRING, count); | ||
| write(pipes[current_id][1], str, strlen(str)); | ||
| } | ||
| char* end_sig = malloc(sizeof(char)); | ||
| read(pipes[current_id][0], end_sig, sizeof(char)); | ||
| close(pipes[current_id][0]); | ||
| close(pipes[current_id][1]); | ||
| free_all_resources(divisions, processes); | ||
| free(end_sig); | ||
| fclose(*fp); | ||
| exit(0); |
| return getpid(); | ||
| } | ||
|
|
||
| int file_search(FILE** fp, const char* to_find, |
There was a problem hiding this comment.
Стоит реализовать параллельный алгоритм через последовательный
Codecov Report
@@ Coverage Diff @@
## master #2 +/- ##
=========================================
Coverage ? 92.54%
=========================================
Files ? 6
Lines ? 228
Branches ? 0
=========================================
Hits ? 211
Misses ? 17
Partials ? 0 Continue to review full report at Codecov.
|
|
зачет |
pull for HW-2